
package stcu.robjects;

import com.nvlled.route.*;

public class GroupMessage extends GroupObject {
    private String sender;
    private String message;

    public GroupMessage(String sender, String gid, String message) {
        super(gid);
        this.sender = sender;
        this.message = message;
    }

    public String getSender() {
        return sender;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public boolean equals(Object obj) {
        GroupMessage message = (GroupMessage) obj;
        return (getId()+"").equals(message.getId()+"") &&
            getSender().equals(message.getSender()) &&
            getMessage().equals(message.getMessage()) &&
            getGroupId().equals(message.getGroupId());
    }

    @Override
    public int hashCode() {
        // lame hashing
        return (getId()+getSender()+getMessage()+getGroupId()).hashCode();
    }
}
